#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int Find(int arr[][4], int x, int y, int n)
{
	int i = 0;
	int j = y-1;
	while (i < x && j >= 0)
	{
		if (arr[i][j] < n)
		{
			i++;
		}
		else if (arr[i][j] > n)
		{
			j--;
		}
		else
			return 1;
	}
	return 0;
}
int main()
{
	int arr[][4] = { {1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16} };
	int ret = Find(arr, 4, 4, 20);
	printf("%d\n", ret);
	return 0;
}